package com.sky.controller.user;

import com.sky.constant.MessageConstant;
import com.sky.dto.ShoppingCartDTO;
import com.sky.entity.ShoppingCart;
import com.sky.result.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.ValueOperations;
import org.springframework.web.bind.annotation.*;

@RestController("userShopController")
@RequestMapping("/user/shop")
@Api(tags = "用户操作接口")
public class ShopController {
    // 注入redis模板对象
    @Autowired
    private RedisTemplate redisTemplate;
    /**
     * 用户获取营业状态
     * @return
     */
    @ApiOperation("获取营业状态")
    @GetMapping("/status")
    public Result getStatus(){
        ValueOperations opsForValue = redisTemplate.opsForValue();
        Object status = opsForValue.get(MessageConstant.KEY);
        return Result.success(status ==null? 0:status);
    }

}
